const utils = require('./utils.js');
const niv = require('node-input-validator');

niv.extend('pdf', ({ value }) => {
  return utils.isValidPdfSignature(value);
});

const rules = {
  'application': 'required|pdf',
  'submittingPartner': 'required|string',
  'receivedDateTimestamp': 'required|dateiso',
  'forms': 'required|array'
};

function getValidator (input) {
  return new niv.Validator(input, rules);
}

module.exports = {
  getValidator
};
